package com.woparker.kiosk.model.impl;

import static android.os.AsyncTask.execute;

import android.content.Context;
import android.graphics.Bitmap;
import android.text.TextUtils;

import com.woparker.kiosk.base.ContextHolder;
import com.woparker.kiosk.bean.MapGroupBean;
import com.woparker.kiosk.model.NavigationModel;
import com.woparker.kiosk.model.VehicleSearchModel;
import com.woparker.kiosk.utils.FileHandler;
import com.woparker.kiosk.utils.SharedPreferencesUtil;

public class NavigationModelImpl implements NavigationModel {
    private FileHandler fileHandler;

    public NavigationModelImpl(Context context) {
        fileHandler = new FileHandler(context);
    }
    @Override
    public void getData(ICallback callback) {
        execute(new Runnable() {
            public void run() {             //ugly
                callback.onResult("hello world");    //10 返回数据
            }
        });
    }

    @Override
    public MapGroupBean getMapGroupBean(String mapGroupUrl) {
        String cachResult = (String) SharedPreferencesUtil.getInstance(ContextHolder.getAppContext()).get(mapGroupUrl, "");
        if (TextUtils.isEmpty(cachResult)) {
            fileHandler.download(mapGroupUrl, new FileHandler.OnMapDownloadListener() {
                @Override
                public void onLoad(String result) {

                }
            });
        } else {

        }
        return null;
    }

    @Override
    public Bitmap getMapImage(String imageUrl) {
        return null;
    }
}
